const obj = {
    name: "zs",
    age: 20,
}

//要拦截obj的name属性的取值，赋值操作，就要用defineProperty给name加一个get，set
Object.defineProperty(obj,"name",{
    enumerable: true,
    configurable: true,
    get(){
        console.log("有人获取了name的值");
        return "我不是zs"
    },
    set(newVal){
        console.log("我不要你给的值","你给的值是"+ newVal);
    }
})

console.log(obj.name);
obj.name = "ls"
